<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Event extends Model
{
    protected $guarded = [];

    public function tags()
    {
        return $this->belongsToMany(Tag::class);
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'creator_id');
    }

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

    public function participants()
    {
        return $this->belongsToMany(User::class,'event_attendee');
    }

    public function comments()
    {
        return $this->hasMany(Comment::class);
    }

    public function invitedUsers()
    {
        return $this->belongsToMany(User::class,'invitations');
    }
}
